import java.util.*;

public class _2023_10_15 {
    public static void main1(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        int i = 0;
        char[] arr = s.toCharArray();
        int l = 0;
        int r = 0;
        List<String> ans = new ArrayList<>();
        int flag = 0;
        for(r = 0; r < arr.length; r++){
            if( arr[r] == ' ' && flag == 0){
                if(l < r){
                    ans.add(s.substring(l, r));
                    l = r + 1;
                }else{
                    l = r + 1;
                }
            }else if(arr[r] == '"'){
                flag++;
                if(flag == 2){
                    ans.add(s.substring(l + 1, r));
                    l = r + 1;
                    flag = 0;
                }
            }
        }
        if(l < r){
            ans.add(s.substring(l, r));
        }
        System.out.println(ans.size());
        for(String e : ans){
            System.out.println(e);
        }
    }

    private static boolean isPrime(int n){
        int i = 2;
        for(i = 2; i <= Math.sqrt(n); i++){
            if(n % i == 0){
                return false;
            }
        }
        return true;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n1 = sc.nextInt();
        int n2 = sc.nextInt();
        if(isPrime(n1) || isPrime(n2)){
            System.out.println(-1);
            return;
        }
        System.out.println(5);
    }
}
